package com.zb_study.outputstream_;

import com.zb_study.outputstream_.Dog;

import java.io.*;

public class ObjectOutStream_ {
    public static void main(String[] args) throws IOException {

        String filePath = "e:\\data.dat";

        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(filePath));

        oos.writeInt(100);
        oos.writeBoolean(true);
        oos.writeChar('H');
        oos.writeDouble(9.5);
        oos.writeUTF("周波");

        oos.writeObject(new Dog("旺财",10));

        oos.close();
        System.out.println("数据保存完毕（序列化形式）");


    }
}


